package com.leyou.service;

import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.leyou.mapper.BrandMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import pojo.Brand;

import java.util.List;

@Service
@Transactional
public class BrandServiceImpl extends ServiceImpl<BrandMapper , Brand> implements BrandService {
    @Autowired
    private BrandMapper brandMapper;
    @Override
    public List<Brand> findAll() {
        return brandMapper.selectList(null);
    }

    @Override
    public IPage<Brand> findByPage(Integer page, Integer size) {
        IPage<Brand> page1=new Page<>(page,size);
        IPage<Brand> brandIPage = brandMapper.selectPage(page1, null);
        return brandIPage;
    }
}
